package ai.leinao.alarm.service;

import ai.leinao.alarm.domain.AlarmInhibit;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * description
 *
 * @author zhong.wang
 * @date 2025/9/8
 **/
@Service
public class AlarmInhibitService {

    /**
     * 获取所有报警抑制规则
     * @return
     */
    public List<AlarmInhibit> getAlarmInhibits(){
        AlarmInhibit rule = new AlarmInhibit();
        rule.setId(1L);
        rule.setName("default");
        rule.setEqualLabels(Arrays.asList("inverter"));
        Map<String, String> sourceLabels = new HashMap<>();
        sourceLabels.put("mainType", "1");
        sourceLabels.put("subType", "communication_failure");
        sourceLabels.put("deviceTypeCode","nbq");
        rule.setSourceLabels(sourceLabels);

        Map<String, String> targetLabels = new HashMap<>();
        targetLabels.put("mainType", "1");
        targetLabels.put("subType", "string_offline");
        targetLabels.put("deviceTypeCode","string_combiner");
        rule.setTargetLabels(targetLabels);

        List<AlarmInhibit> alarmInhibits = Arrays.asList(rule);
        return alarmInhibits;
    }
}
